package com.bootcamp.javase2.io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;

/**
 * @program: IOCode
 * @description:
 * @author: Keyu Li
 * @create: 2021-09-09 19:34
 **/

public class createFileFromInput {
    public static final Scanner SCANNER = new Scanner(System.in);
    public static void main(String[] args) throws IOException {
        // input
        System.out.println("please input File name with txt file type: ");
        String fileName = SCANNER.nextLine();
        System.out.println("please input file content: ");
        byte[] bytes = SCANNER.nextLine().getBytes();

        // write
        FileOutputStream out = new FileOutputStream(fileName);
        out.write(bytes);

        //close
        out.close();
        // print
        PrintFile.print(fileName);
    }
}

